package book_management.operation.impl;

import book_management.book.BookList;
import book_management.operation.IOperation;

//更新书籍操作
public class UpdateOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("请输入你要更新的书籍名称：");
        String nameBook = scanner.nextLine();
        if(bookList.contains(nameBook)){
            System.out.println("请输入您要添加的书籍价格:");
            double price = scanner.nextDouble();
            // 吃掉\n换行符
            scanner.nextLine();
            System.out.println("请输入您要添加的书籍类别:");
            String type = scanner.nextLine();
            System.out.println("请输入您要添加的书籍状态(0:ture/1:false):");
            int isBorrowed = scanner.nextInt();
            // 吃掉\n换行符
            scanner.nextLine();
            bookList.UpdateBook(nameBook,price, type, isBorrowed);
            System.out.println("更新成功~");
        }else{
            System.out.println("没有这本书~");
        }

    }
}
